package edu.kit.aifb.ldstream.repository.ldcrawler;

import java.net.URI;

import org.apache.http.HttpEntity;

import com.ontologycentral.ldspider.hooks.fetch.FetchFilter;

public class FetchFilterAllowSuffix implements FetchFilter {

	private String[] suffixes;
	
	public FetchFilterAllowSuffix(String[] suffixes) {
		this.suffixes = suffixes;
	}

	
	public boolean fetchOk(URI u, int status, HttpEntity hen) {
		for (String suffix : this.suffixes) {
			if (u.getPath().endsWith(suffix)) {
				return true;
			}
		}
		
		return false;
	}

}
